package com.wdb.modules.system.rest;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wdb.modules.system.domain.Dict;
import com.wdb.modules.system.domain.vo.DictQueryCriteria;
import com.wdb.modules.system.service.DictService;
import com.wdb.utils.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: wendaobai@qq.com
 * @date: 2024/8/29 星期四 9:38
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "系统：字典管理")
@RequestMapping("/api/dict")
public class DictController {
    private final DictService dictService;
    @ApiOperation("查询字典")
    @GetMapping
    public ResponseEntity<PageResult<Dict>> getList(DictQueryCriteria criteria, Page<Object> page){

        return new ResponseEntity<>(dictService.queryAll(criteria,page), HttpStatus.OK);
    }
    @ApiOperation("查询字典")
    @GetMapping(value = "/all")
    public ResponseEntity<List<Dict>> queryAllDict(){
        return new ResponseEntity<>(dictService.queryAll(new DictQueryCriteria()),HttpStatus.OK);
    }
}
